package br.com.hermes.android.util;

import android.content.Context;
import android.widget.Toast;


public class ToastUtil {
	
	private Context context;
	private Toast toast;
	
	public ToastUtil(Context context){
		this.context = context;
	}
	
	
	/**
	 * @return the context
	 */
	public Context getContext() {
		return context;
	}



	/**
	 * @param context the context to set
	 */
	public void setContext(Context context) {
		this.context = context;
	}


	public void showMessage(String message) {
		if (toast != null) {
			toast.setText(message);
		} else {
			toast = Toast.makeText(getContext(), message, Toast.LENGTH_LONG);
		}
		
		toast.show();
	}

	public void closeToast() {
		if (toast != null)
			toast.cancel();
	}
	

}